package lib

import (
	_ "github.com/go-sql-driver/mysql"
	"database/sql"
	"app/conf"
)
var db *sql.DB
func InitMysql(){
	var err error
	db, err = sql.Open("mysql", conf.MYSQL_USERNAME+":"+conf.MYSQL_PASSWORD+"@tcp("+conf.MYSQL_HOSTNAME+":"+conf.MYSQL_HOSTPORT+")/app?charset=utf8")
	if err != nil {
		return
	}
	db.SetMaxIdleConns(20)
	db.SetMaxOpenConns(20)
}

func GetDb()(*sql.DB)  {
	return db
}

